package cn.iocoder.mall.shop.service.service.impl;

import cn.iocoder.mall.shop.service.entities.ShopClerkRelationShip;
import cn.iocoder.mall.shop.service.mapper.ShopClerkRelationShipMapper;
import cn.iocoder.mall.shop.service.service.IShopClerkRelationShipService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 店铺店员关联关系
 * @Author: jeecg-boot
 * @Date:   2019-10-30
 * @Version: V1.0
 */
@Service
public class ShopClerkRelationShipServiceImpl extends ServiceImpl<ShopClerkRelationShipMapper, ShopClerkRelationShip> implements IShopClerkRelationShipService {

    @Resource
    ShopClerkRelationShipMapper shopClerkRelationShipMapper;

    /**
     * 批量解除店员
     * @param shopId
     * @param list
     * @return
     */
    @Override
    public int removeByShopIdsAndClerkIds(String shopId, List<String> list) {
        return shopClerkRelationShipMapper.removeByShopIdsAndClerkIds(shopId,list);
    }
    /**
     * 商铺-通过商铺id和店员id删除与店员的关系
     * @param shopId
     * @param clerkId
     */
    @Override
    public void deleteOneShopClerk(String shopId,String clerkId){
        shopClerkRelationShipMapper.deleteShopClerk(shopId,clerkId);
    }
    /**
     * 商铺批量-通过商铺id和店员id删除与店员的关系
     * @param shopIds
     * @param clerkIds
     */
    @Override
    public void deleteListShopClerk(String shopIds,List<String> clerkIds){
        shopClerkRelationShipMapper.deleteShopClerks(shopIds,clerkIds);
    }
    /**
     * 给店铺分配店员，，，，，分配之前，先把店员原先和店铺的关系删除
     * @param clerkId
     * @return
     */
    @Override
    public boolean deleteAllReaOfClerk(String clerkId) {
        return shopClerkRelationShipMapper.deleteAllReaOfClerk(clerkId);
    }

    @Override
    public ShopClerkRelationShip getOneByUserIdAndShopId(String userId, String shopId) {
        return shopClerkRelationShipMapper.getOneByUserIdAndShopId(userId,shopId);
    }


}
